﻿Public Class Tera計算AIMenuF
    Private Sub Tera計算AIMenu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        著作L.Text = 著作

    End Sub
    Private Sub EIQ_AIモデル作成Bt_Click(sender As Object, e As EventArgs) Handles EIQ_AIモデル作成Bt.Click
        Try
            Dim startup As String = Application.StartupPath
            Dim candidates As String() = {
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "..", "EIQ_AIモデル作成", "bin", "Debug", "EIQ_AIモデル作成.exe")),
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "..", "EIQ_AIモデル作成", "bin", "Release", "EIQ_AIモデル作成.exe")),
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "EIQ_AIモデル作成", "bin", "Debug", "EIQ_AIモデル作成.exe")),
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "EIQ_AIモデル作成", "bin", "Release", "EIQ_AIモデル作成.exe"))
            }

            Dim exePath As String = candidates.FirstOrDefault(Function(p) System.IO.File.Exists(p))
            If String.IsNullOrEmpty(exePath) Then
                MessageBox.Show("EIQ_AIモデル作成 の実行ファイルが見つかりませんでした。ビルドされていることを確認してください。", "起動エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If

            Dim psi As New System.Diagnostics.ProcessStartInfo(exePath) With {.UseShellExecute = True}
            System.Diagnostics.Process.Start(psi)
        Catch ex As Exception
            MessageBox.Show("EIQ_AIモデル作成 を起動できませんでした: " & ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
    Private Sub Tera計算EIQAIBt_Click(sender As Object, e As EventArgs) Handles Tera計算EIQAIBt.Click
        Try
            Dim startup As String = Application.StartupPath
            Dim candidates As String() = {
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "..", "Tera計算EIQAI", "bin", "Debug", "Tera計算EIQAI.exe")),
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "..", "Tera計算EIQAI", "bin", "Release", "Tera計算EIQAI.exe")),
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "Tera計算EIQAI", "bin", "Debug", "Tera計算EIQAI.exe")),
                System.IO.Path.GetFullPath(System.IO.Path.Combine(startup, "..", "Tera計算EIQAI", "bin", "Release", "Tera計算EIQAI.exe"))
            }

            Dim exePath As String = candidates.FirstOrDefault(Function(p) System.IO.File.Exists(p))
            If String.IsNullOrEmpty(exePath) Then
                MessageBox.Show("Tera計算EIQAI の実行ファイルが見つかりませんでした。ビルドされていることを確認してください。", "起動エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If

            Dim psi As New System.Diagnostics.ProcessStartInfo(exePath) With {.UseShellExecute = True}
            System.Diagnostics.Process.Start(psi)
        Catch ex As Exception
            MessageBox.Show("Tera計算EIQAI を起動できませんでした: " & ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Try
            Dim psi As New System.Diagnostics.ProcessStartInfo("https://ai-jp.eiqtera.com/") With {.UseShellExecute = True}
            System.Diagnostics.Process.Start(psi)
            LinkLabel1.LinkVisited = True
        Catch ex As Exception
            MessageBox.Show("リンクを開けませんでした: " & ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
        Try
            Dim psi As New System.Diagnostics.ProcessStartInfo("https://ai-jp.eiqtera.com/eiq_ai_model_creation_jp.html") With {.UseShellExecute = True}
            System.Diagnostics.Process.Start(psi)
            LinkLabel2.LinkVisited = True
        Catch ex As Exception
            MessageBox.Show("リンクを開けませんでした: " & ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub

    Private Sub LinkLabel3_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked
        Try
            Dim psi As New System.Diagnostics.ProcessStartInfo("https://ai-jp.eiqtera.com/tera_calculation_eiqai_jp.html") With {.UseShellExecute = True}
            System.Diagnostics.Process.Start(psi)
            LinkLabel3.LinkVisited = True
        Catch ex As Exception
            MessageBox.Show("リンクを開けませんでした: " & ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub
End Class
